home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1997 #3
/
Amiga Plus CD - 1997 - No. 03.iso
/
pd
/
programmierung
/
alienbreed3d2_src
/
amos
/
palettecreator.amos
/
palettecreator.amosSourceCode
Wrap
AMOS Source Code
|
1997-01-31
|
5KB
|
258 lines
Reserve As Work 15,40000
Dim R(255),G(255),B(255)
Screen Open 0,640,256,4,Hires
Curs Off : Flash Off : Cls 0
Wait Vbl
Limit Mouse
Global N
Dim TY(256)
For A=0 To 256 : TY(A)=0 : Next
Set Rainbow 0,1,257,"(1,0,1)","(1,0,1)","(1,0,1)"
Rainbow 0,0,41,258
Ink 1
Bar 340,0 To 640,256
Ink 3
Bar 0,200 To 56*2,256
Pen 2
Ink 2
Colour 2,$FFF
Colour 3,$F00
Change Mouse 2
CO=$FFF
Set Slider 2,2,0,,0,2,2,
Hslider 0,20 To 256,30,256,256,1
Hslider 0,40 To 256,50,256,256,1
Hslider 0,60 To 256,70,256,256,1
Colour 3,CO
Reserve Zone 14
Set Zone 1,0,20 To 256,30
Set Zone 2,0,40 To 256,50
Set Zone 3,0,60 To 256,70
Gosub DRSCR
R=15 : G=15 : B=15 : MO=0 : ST=0 : EN=255
Ink 2
Draw 320,ST To 328,ST
Draw 320,EN To 328,EN
R=255 : G=255 : B=255
10
Repeat
X=X Screen(0,X Mouse) : Y=Y Screen(0,Y Mouse)
Locate 0,10 : Print Y;" "
M=Mouse Key
A$=Inkey$
If A$="s" Then Gosub SAVFIL
If A$="S" Then Gosub SAVSOURCE
If A$="l" Then Gosub LOAFIL
If A$="L" Then Gosub LOABRILFIL
Until M<>0
If X<320 Then Goto 20
If MO=0 and X>340 and M=1
CO=(R/16)*$100+(G/16)*$10+(B/16)
Rain(0,Y+1)=CO
R(Y)=R : G(Y)=G : B(Y)=B
End If
If M=2 and X>340
R=R(Y) : G=G(Y) : B=B(Y)
CO=(R/16)*$100+(G/16)*$10+(B/16)
Gosub SLID
Locate 32,3 : Print R;" "
Locate 32,5 : Print G;" "
Locate 32,7 : Print B;" "
End If
If X<340 and M=1 Then Ink 0 : Draw 320,ST To 328,ST : ST=Y
If X<340 and M=2 Then Ink 0 : Draw 320,EN To 328,EN : EN=Y
Ink 2 : Draw 320,ST To 328,ST
Draw 320,EN To 328,EN
If EN<ST Then P=EN : EN=ST : ST=P
Rainbow 0,0,41,258
Goto 10
20
If X<280 Then Goto 90
If M=1 Then Ink 2 : TY(Y)=1 Else Ink 0 : TY(Y)=0
Draw 280,Y To 156*2,Y
Goto 10
90
Z=Zone(X,Y)
Pen 2 : Paper 0
If Z=1 Then Gosub FINDPOS : Hslider 0,20 To 256,30,256,H,1 : R=H : Locate 32,3 : Print R;" "
If Z=2 Then Gosub FINDPOS : Hslider 0,40 To 256,50,256,H,1 : G=H : Locate 32,5 : Print G;" "
If Z=3 Then Gosub FINDPOS : Hslider 0,60 To 256,70,256,H,1 : B=H : Locate 32,7 : Print B;" "
If Z>3 and Z<9 and Z<>7 Then MO=Z-4
If Z=7 Then Gosub SPREAD
CO=(R/16)*256+(G/16)*16+(B/16)
Colour 3,CO
Goto 10
'
SLID:
Hslider 0,20 To 256,30,256,R,1
Hslider 0,40 To 256,50,256,G,1
Hslider 0,60 To 256,70,256,B,1
Colour 3,CO
Return
'
SPREAD:
CO1=Rain(0,ST)
CO2=Rain(0,EN)
R1=R(ST) : G1=G(ST) : B1=B(ST)
R2=R(EN)-R1 : G2=G(EN)-G1 : B2=B(EN)-B1
D=EN-ST
For A=0 To D
RA=R1+(R2*A)/D
GA=G1+(G2*A)/D
BA=B1+(B2*A)/D
R(A+ST)=RA
G(A+ST)=GA
B(A+ST)=BA
Rain(0,A+ST+1)=(RA/16)*256+(GA/16)*16+(BA/16)
Next
Rainbow 0,0,41,258
Return
'
FINDPOS:
H=X
If H>255 Then H=255
Return
'
Procedure DK[VA]
Doke N,VA : Add N,2
End Proc
DRSCR:
Ink 2
Paper 2
Pen 0
Restore BILLY
For A=0 To 4
X=A*16
Bar X,0 To X+14,15
Locate A*2,0
Read A$ : Print A$
Read A$ : Locate A*2,1 : Print A$
Set Zone A+4,X,0 To X+15,15
Next
Return
'
SAVFIL:
Screen Open 2,320,256,4,Lowres
Curs Off : Flash Off : Cls 0
Colour 3,$FFF
Pen 3
Input "filename ";N$
N=Start(15)
For A=0 To 255 : Doke N,R(A) : Doke N+2,G(A) : Doke N+4,B(A) : Add N,6 : Next
Bsave N$,Start(15) To N
Screen 0
Screen To Front 0
Return
'
SAVSOURCE:
Screen Open 2,640,256,4,Hires
Paper 0
Curs Off : Flash Off : Cls 0
Colour 3,$FFF
Pen 3
Print "Saving source file"
Input "filename ";N$
N=Start(15)
For X=31 To 24 Step -1
C=0
For BM=0 To 7
V=$C40+BM*$2000
'M$=" dc.w $106,"+Hex$(V)
DK[$106] : DK[V]
'Gosub POKIT
For A=0 To 31
R=R(C) : G=G(C) : B=B(C)
R=R-255
R=(R*X)/31
G=(G*X)/31
B=(B*X)/31
R=255+R
CO=(R/16)*$100+(G/16)*$10+(B/16)
V=$180+A*2
DK[V] : DK[CO]
'M$=" dc.w "+Hex$(V)+","+Hex$(CO)
' Print M$ :
'Gosub POKIT
Add C,1
Next
Next
C=0
For BM=0 To 7
V=$E40+BM*$2000
'M$=" dc.w $106,"+Hex$(V)
'Gosub POKIT
DK[$106] : DK[V]
For A=0 To 31
R=R(C) : G=G(C) : B=B(C)
R=R-255
R=(R*X)/31
G=(G*X)/31
B=(B*X)/31
R=255+R
CO=(R and $F)*$100+(G and $F)*$10+(B and $F)
V=$180+A*2
DK[V] : DK[CO]
'M$=" dc.w "+Hex$(V)+","+Hex$(CO)
' Print M$
'Gosub POKIT
Add C,1
Next
Next
DK[$FFFF] : DK[$FFFE]
'M$=" dc.w $ffff,$fffe"
'Gosub POKIT
Next
Bsave N$,Start(15) To N
Screen 0
Screen To Front 0
Return
'
POKIT:
For T=1 To Len(M$) : Poke N,Asc(Mid$(M$,T,1)) : Add N,1 : Next
Poke N,10 : Add N,1
Return
'
LOAFIL:
Screen Open 2,320,256,4,Lowres
Curs Off : Flash Off : Cls 0
Colour 3,$FFF
Pen 3
Input "filename ";N$
Bload N$,Start(15)
N=Start(15)
For A=0 To 255 : R(A)=Deek(N) : G(A)=Deek(N+2) : B(A)=Deek(N+4) : Add N,6
Rain(0,A+1)=(R(A)/16)*$100+(G(A)/16)*$10+(B(A)/16)
Next
Screen 0
Screen To Front 0
Return
LOABRILFIL:
Screen Open 2,320,256,4,Lowres
Curs Off : Flash Off : Cls 0
Colour 3,$FFF
Pen 3
Input "filename ";N$
Bload N$,Start(15)
N=Hunt(Start(15) To Start(15)+10000,"CMAP")+8
For A=0 To 255 : R(A)=Peek(N) : G(A)=Peek(N+1) : B(A)=Peek(N+2) : Add N,3
Rain(0,A+1)=(R(A)/16)*$100+(G(A)/16)*$10+(B(A)/16)
Next
Screen 0
Screen To Front 0
Return
BILLY:
Data "P"," ","S","t","E","n","S","p","C","o"